<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>digichef.voting.views</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="digichef-module.html">Package&nbsp;digichef</a> ::
        <a href="digichef.voting-module.html">Package&nbsp;voting</a> ::
        Module&nbsp;views
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="digichef.voting.views-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module views</h1><p class="nomargin-top"><span class="codelink"><a href="digichef.voting.views-pysrc.html">source&nbsp;code</a></span></p>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="digichef.voting.views-module.html#vote_on_object" class="summary-sig-name">vote_on_object</a>(<span class="summary-sig-arg">request</span>,
        <span class="summary-sig-arg">model</span>,
        <span class="summary-sig-arg">direction</span>,
        <span class="summary-sig-arg">post_vote_redirect</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">object_id</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">slug</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">slug_field</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">template_name</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">template_loader</span>=<span class="summary-sig-default">loader</span>,
        <span class="summary-sig-arg">extra_context</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">context_processors</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">template_object_name</span>=<span class="summary-sig-default">'object'</span>,
        <span class="summary-sig-arg">allow_xmlhttprequest</span>=<span class="summary-sig-default">False</span>)</span><br />
      Generic object vote function.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="digichef.voting.views-pysrc.html#vote_on_object">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="json_error_response"></a><span class="summary-sig-name">json_error_response</span>(<span class="summary-sig-arg">error_message</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="digichef.voting.views-pysrc.html#json_error_response">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="digichef.voting.views-module.html#xmlhttprequest_vote_on_object" class="summary-sig-name">xmlhttprequest_vote_on_object</a>(<span class="summary-sig-arg">request</span>,
        <span class="summary-sig-arg">model</span>,
        <span class="summary-sig-arg">direction</span>,
        <span class="summary-sig-arg">object_id</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">slug</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">slug_field</span>=<span class="summary-sig-default">None</span>)</span><br />
      Generic object vote function for use via XMLHttpRequest.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="digichef.voting.views-pysrc.html#xmlhttprequest_vote_on_object">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="VOTE_DIRECTIONS"></a><span class="summary-name">VOTE_DIRECTIONS</span> = <code title="'up', 1, ('down',-1), ('clear', 0)">'up', 1, ('down',-1), ('clear', 0)</code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="vote_on_object"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">vote_on_object</span>(<span class="sig-arg">request</span>,
        <span class="sig-arg">model</span>,
        <span class="sig-arg">direction</span>,
        <span class="sig-arg">post_vote_redirect</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">object_id</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">slug</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">slug_field</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">template_name</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">template_loader</span>=<span class="sig-default">loader</span>,
        <span class="sig-arg">extra_context</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">context_processors</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">template_object_name</span>=<span class="sig-default">'object'</span>,
        <span class="sig-arg">allow_xmlhttprequest</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="digichef.voting.views-pysrc.html#vote_on_object">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Generic object vote function.

The given template will be used to confirm the vote if this view is
fetched using GET; vote registration will only be performed if this
view is POSTed.

If ``allow_xmlhttprequest`` is ``True`` and an XMLHttpRequest is
detected by examining the ``HTTP_X_REQUESTED_WITH`` header, the
``xmlhttp_vote_on_object`` view will be used to process the
request - this makes it trivial to implement voting via
XMLHttpRequest with a fallback for users who don't have JavaScript
enabled.

Templates:``&lt;app_label&gt;/&lt;model_name&gt;_confirm_vote.html``
Context:
    object
        The object being voted on.
    direction
        The type of vote which will be registered for the object.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="xmlhttprequest_vote_on_object"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">xmlhttprequest_vote_on_object</span>(<span class="sig-arg">request</span>,
        <span class="sig-arg">model</span>,
        <span class="sig-arg">direction</span>,
        <span class="sig-arg">object_id</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">slug</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">slug_field</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="digichef.voting.views-pysrc.html#xmlhttprequest_vote_on_object">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Generic object vote function for use via XMLHttpRequest.

Properties of the resulting JSON object:
    success
        ``true`` if the vote was successfully processed, ``false``
        otherwise.
    score
        The object's updated score and number of votes if the vote
        was successfully processed.
    error_message
        Contains an error message if the vote was not successfully
        processed.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Apr  1 02:28:20 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
